{# src/Pyaf/GymBundle/Resources/views/AdminProfesor/list.html.twig #}
{% extends "PyafGymBundle::layout_admin.html.twig" %}

{% block title %} Pyaf {% endblock %}
{% block tituloSector %}<i class="icon-book"></i> Profesores - Asistencia de los Profesores{% endblock %}
{% block nombreSector %} Profesores / Asistencias{% endblock %}
{% block dashboardContent %}{% endblock %}

{% block content %}
    <div class="container-fluid" id="content-area" style="padding-right: 30px;">  
        
        {% if app.session.hasFlash('alertaAdminProfesorSuccess') %}
            <div class="alert alert-success">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                {{ app.session.flash('alertaAdminProfesorSuccess') }}
            </div>
        {% endif %}
        {% if app.session.hasFlash('alertaAdminProfesorError') %}
            <div class="alert alert-error">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                {{ app.session.flash('alertaAdminProfesorError') }}
            </div>
        {% endif %}
        
    <div class="row-fluid">
        <div class="span12">
            <div class="box">
                <div class="box-head"><i class="icon-book"></i><span>Tablero de Asistencia</span></div>
                <div class="box-body">
                    
                    <div class="span5">
                        <div class="mini-layout">
                            <div class="mini-layout-header">
                                <i class="icon-th-large"></i>
                                <span>Profesores</span>
                            </div>
                            <div class="mini-layout-body">  
                                <table id="table" class="table table-nomargin table-bordered dataTable table-striped table-hover">
                                    <thead><tr>
                                            <th>Nombre y Apellido</th>                                                
                                            <th>Habilitado</th>
                                            <th>Asistencias</th>
                                    </tr></thead>
                                    <tbody>

                                    {% for profesor in profesores %}

                                        <tr style="">
                                            <td>
                                                <div>{{profesor.nombreCompleto}}</div>
                                            </td>
                                            <td style="text-align: center;">
                                                {% if profesor.persona.habilitado %}
                                                    <i class="icon-check"></i>
                                                {% else %}
                                                    <i class="icon-check-empty"></i>
                                                {% endif %}                                            
                                            </td>
                                            <td style="text-align: center;">
                                                <button class='button button-basic btn-min button-basic-blue' onclick='showProfesor("{{ path('admin_profesores_asistenciashow', {'id': profesor.id }) }}")'><i class="icon-eye-open"></i> ver</button>
                                            </td> 
                                        </tr>

                                    {% endfor %}

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="span7">
                        <div class="mini-layout">
                            <div class="mini-layout-header">
                                <i class="icon-leaf"></i>
                                <span>Asistencias del Profesor</span>
                                <a class="text-right offset6" href="javascript:print()" rel='tooltip' title="Print statistics"><i class="icon-print"></i> Imprimir</a>
                            </div>
                            <div class="mini-layout-body" id="box-info-profesor">    
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

{% endblock %}
    
{% block javascripts %}
    <script type="text/javascript">

        function showProfesor(data){                
            $('#box-info-profesor').load(data);             
        }
    </script>
{% endblock %}
